2022-08-22 00:05:08
Setting up WSL2.
WSL 1 is fantastic, but lacks some of the features (namely fstab
mounting) that WSL 2 brings to the table. WSL and WSL 2 are a bit confusing to setup because of the lack of centralization; "Go to the Windows Features panel, then download this random EXE from a browser...".
There are multiple ways to go about conducting this, but here's the simplest way to setup both versions.
Open PowerShell as administrator (Shortcut: Windows + x, then hit a, then Alt + y).
Put these two commands into the PowerShell window:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Hit enter a few times.
Once the commands are done running, restart your computer. Yes, you're still forced to restart Windows in 2022 for feature additions.
Now, you must choose a distro. I prefer Debian. The other installations are the same process, so choose whatever. You have two options depending on your Windows 10 version:
Add-AppxPackage
import (for Windows 10 LTSC users)Just type the distro you want into the search bar - like Ubuntu - and hit the install button. When that's done, open the distro EXE you downloaded from the MS store and go through the installation process. You can find it by hitting the Start button and typing the distro name.
Skip this step if you've already done the Windows Store Method.
Click one of these distro links:
That should be all of the officially supported ones hosted by Microsoft.
After the download, open a PowerShell window as administrator once again. Then, navigate to the directory you downloaded the appx file at (probably your downloads directory), then run the following commmand (note: the file name will be different depending on your distro):
Add-AppxPackage Debian.appx
Then, run the newly installed EXE on your system. If you installed Debian, run the Debian program, if you installed Ubuntu, run the Ubuntu program, and so on. Go through the setup process until your new user is created.
That's WSL 1 + distro installation complete. Now we can convert this WSL 1 distro to WSL 2 to get those oh-so-fantastic features.
Open a PowerShell window as administrator once again. Run the following commmand (note: the file name will be different depending on your distro):
wsl --set-version Debian 2
This will take a minute, but once it's done, you'll have WSL 2. Easy as that.